package com.frogs.ucenter.dao.ibatis;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Repository;

import com.frogs.framework.base.dao.ibatis.BaseDaoIbatis;
import com.frogs.framework.util.PageList;
import com.frogs.ucenter.dao.UserPraiseInfoDao;
import com.frogs.ucenter.entity.UserPraiseInfo;
import com.frogs.ucenter.entity.ext.UserPersonInfoExt;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("userPraiseInfoDao")
public class UserPraiseInfoDaoImpl extends BaseDaoIbatis<UserPraiseInfo> implements UserPraiseInfoDao {

    public UserPraiseInfoDaoImpl() {
        super();
        setNameSpace( "user_praise_info" );
    }

    @Required
    @Autowired
    public void setSqlMapClientAutowired(SqlMapClient sqlMapClient) {
        super.setSqlMapClient( sqlMapClient );
    }

	@Override
	public PageList<UserPersonInfoExt> selectByMapForPerson(
			HashMap<String, Object> params, int pageNo, int pageSize) {
		return queryforPageList(getNameSpace() + ".selectByMapForPerson", params, pageNo, pageSize, false);
	}
	
	@Override
	public Map<String, Object> selectPraiseByMap(Map<String, Object> params) {
		PageList<Map<String, Object>> list = queryforPageList(getNameSpace() + ".selectPraiseByMap", params, 1, 1, false);
		if (list.size() > 0) {
			return list.get(0);
		} else {
			return null;
		}
	}
}